package com.nycreativity.elecreativity.entity.enums

import org.springframework.util.ObjectUtils

enum class RoleEnum(
    val roleId: Long,
    val des: String
) {


    MANAGER(0,"管理员"),
    USER(1,"用户");

    companion object{
        /**
         * 通过value取枚举
         * @param value
         * @return
         */
        fun getTypeByValue(value : Long): RoleEnum?{
            if (ObjectUtils.isEmpty(value)){
                return null;
            }
            val values = values()
            values.forEach {
                if (it.roleId == value) {
                    return it;
                }
            }
            return null;
        }
    }


}